package com.qys.livesMall.finance.model.dto;

import com.qys.livesMall.common.message.QysLang;
import com.qys.livesMall.finance.enums.AccountBusinessTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

/**
 * @menu TransferAccountDto
 * @date 2023/07/28 18:10
 */
@Data
@Accessors(chain = true)
public class TransferAccountHandle {

    /**
     * 支出账户
     */
    private AccountInfo out;
    /**
     * 进入账户
     */
    private AccountInfo in;
    /**
     * 发生金额
     */
    private BigDecimal amountIncurred;

    /**
     * 业务编码
     */
    private String businessNo;
    /**
     * 备注
     */
    private String description;
    /**
     * @LINK PayMethod
     * 支付方式
     */
    private String payMethod;

    /**
     * 业务分类
     */
    private AccountBusinessTypeEnum businessType;
    /**
     * 处理结果
     */
    private boolean success =false;

    /**
     * 交易流水号
     */
    private Long serialNumber;

    /**
     * 备注
     */
    private QysLang message;

    public static TransferAccountHandle build(AccountInfo out,AccountInfo in,RWHandle handle){
        TransferAccountHandle transfer=new TransferAccountHandle();
        BeanUtils.copyProperties(handle,transfer);
        transfer.setOut(out).setIn(in);
        return transfer;
    }

    public static TransferAccountHandle build(AccountInfo out,AccountInfo in,FinancePayDTO handle){
        TransferAccountHandle transfer=new TransferAccountHandle();
        BeanUtils.copyProperties(handle,transfer);
        transfer.setOut(out).setIn(in);
        return transfer;
    }
}

